#include "opencv2/opencv.hpp"

#define MARKER_SIZE (70) 
using namespace cv;

class Marker{
	float x,y;
	vector<Point> contour;
	Marker(float x,float y,vector<Point>& contour){
		this->x=x;
		this->y=y;
		this->contour=contour;
	}
};

bool detectMarker_cpp(Mat& src){
	Mat gsImage;
	cvtColor(src,gsImage,CV_BGR2GRAY);
	GaussianBlur(gsImage,gsImage,Size( 3, 3 ),0,0);
	threshold(gsImage,gsImage, 0, 255, CV_THRESH_BINARY | CV_THRESH_OTSU);
	bitwise_not(gsImage,gsImage);

	Mat gsImageContour;
	gsImage.copyTo(gsImageContour);

	vector<vector<Point> > contours;

	vector<Vec4i> hierarchy;
	findContours(gsImageContour,contours,hierarchy,CV_RETR_CCOMP,CV_CHAIN_APPROX_SIMPLE);

	//vector<Point>polycontour;
	//approxPolyDP(Mat(contours), polycontour, 3, true);
	drawContours( src, contours, -1, Scalar(128,255,255),
		3, CV_AA, hierarchy);
	return true;
}